package com.itcat.service.impl;

import com.itcat.api.mysql.PmsSkuStockApi;
import com.itcat.mysql.pojo.PmsSkuStock;
import com.itcat.service.PmsSkuStockService;
import org.apache.dubbo.config.annotation.DubboReference;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * @author Jerry Broker
 * @project_name rainbow-mall
 * @create 2022-04-04 9:16
 */
@Service
public class PmsSkuStockServiceImpl implements PmsSkuStockService {

    @DubboReference
    private PmsSkuStockApi pmsSkuStockApi;

    /**
     * 根据商品ID及sku编码模糊搜索sku库存
     * @param pid
     * @param keyword
     * @return
     */
    @Override
    public List<PmsSkuStock> getSkuByPid(Integer pid, String keyword) {
        List<PmsSkuStock> list = pmsSkuStockApi.getSkuByPid(pid, keyword);
        return list;
    }

    /**
     * 批量更新sku库存信息
     * @param skuStockList
     */
    @Override
    public void updateSku(Integer pid, List<PmsSkuStock> skuStockList) {
        pmsSkuStockApi.updateSku(skuStockList);
    }
}
